package com.sx.medicinecard.common;

import org.springframework.beans.factory.annotation.Value;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class MyThreadPoolSingleton {

    private static int THREAD_POOL_SIZE = 10;

    private static volatile ExecutorService executorService;

    private MyThreadPoolSingleton() {
        // 私有构造函数，防止外部实例化
    }

    public static ExecutorService getInstance() {
        if (executorService == null) {
            synchronized (MyThreadPoolSingleton.class) {
                if (executorService == null) {
                    executorService = Executors.newCachedThreadPool();
                }
            }
        }
        return executorService;
    }
}
